home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / Clueless.swf / scripts / PowerupSlot.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.6 KB  |  66 lines

  1. package
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.display.DisplayObjectContainer;
  5.    import flash.display.MovieClip;
  6.    
  7.    [Embed(source="/_assets/assets.swf", symbol="PowerupSlot")]
  8.    public class PowerupSlot extends MovieClip
  9.    {
  10.        
  11.       
  12.       internal var _powerup:Powerup = null;
  13.       
  14.       public function PowerupSlot()
  15.       {
  16.          _powerup = null;
  17.          super();
  18.       }
  19.       
  20.       public static function extractFromStage(param1:DisplayObjectContainer) : Array
  21.       {
  22.          var _loc2_:int = 0;
  23.          var _loc3_:Array = null;
  24.          var _loc4_:DisplayObject = null;
  25.          _loc2_ = 0;
  26.          _loc3_ = new Array();
  27.          _loc2_ = 0;
  28.          while(_loc2_ < param1.numChildren)
  29.          {
  30.             if((_loc4_ = param1.getChildAt(_loc2_)) is PowerupSlot)
  31.             {
  32.                _loc3_.push(_loc4_);
  33.             }
  34.             _loc2_++;
  35.          }
  36.          _loc3_.sortOn("name");
  37.          return _loc3_;
  38.       }
  39.       
  40.       public function get AttachedPowerup() : Powerup
  41.       {
  42.          return _powerup;
  43.       }
  44.       
  45.       public function removePowerup() : void
  46.       {
  47.          if(_powerup != null)
  48.          {
  49.             removeChild(_powerup);
  50.             _powerup = null;
  51.          }
  52.       }
  53.       
  54.       public function attachPowerup(param1:Powerup) : void
  55.       {
  56.          removePowerup();
  57.          _powerup = param1;
  58.          param1.scaleX = 1;
  59.          param1.scaleY = 1;
  60.          param1.x = 0;
  61.          param1.y = 0;
  62.          addChild(param1);
  63.       }
  64.    }
  65. }
  66.